package cn.enited.devtools.apiaggregator.converter;

import cn.enited.devtools.apiaggregator.api.vo.ApiAnalysisObject;
import cn.enited.devtools.apiaggregator.api.vo.RemoteService;
import cn.enited.devtools.apiaggregator.entity.ApiAggObject;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface ApiAnalysisObjectConverter extends EntityConverter {

    @Mappings({
            @Mapping(target = "name", source = "name"),
            @Mapping(target = "projectName", source = "projectName")
    })
    ApiAnalysisObject apiAggObject2AnalysisObject(ApiAggObject entity);

    @Mappings({
            @Mapping(target = "id", source = "id"),
            @Mapping(target = "path", source = "path"),
            @Mapping(target = "method", source = "method"),
            @Mapping(target = "dataType", source = "dataType")
    })
    RemoteService apiAggEntry2RemoteService(ApiAggObject.Entry entry);
}
